<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script type="text/javascript" src="{{url_for('static',filename='js/jquery.min.js')}}"></script>
	<script src="{{url_for('static',filename='js/raydreams.js')}}"></script>
    <script src="{{url_for('static',filename='js/bootstrap.min.js')}}"></script>
    <link rel="stylesheet" href="{{url_for('static',filename='css/bootstrap.min.css')}}">
    <title>Title</title>
</head>
<body>
        <nav class="navbar navbar-default" role="navigation">
    <div class="container-fluid">
    <div class="navbar-header">
        <a class="navbar-brand" href="#">盯盘宝后台管理系统</a>
    </div>
    <div>
        <ul class="nav navbar-nav">
            <li ><a href="{{ url_for('start_web') }}">首页</a></li>
            <li ><a href="{{ url_for('permission_manage') }}">权限配置</a></li>
        </ul>
        <ul class="nav navbar-nav navbar-right">
            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                    管理员{{ session['admin'] if session['admin'] else "未登录" }}
                    <b class="caret"></b>
                </a>
                <ul class="dropdown-menu">
                    <li><a href="{{ url_for("login_out") }}">退出</a></li>
                </ul>
            </li>
        </ul>
    </div>
    </div>
</nav>
<div id="condition_select">
    <h3 align="center">条件筛选</h3>
    <div id="select_all" align="center">
    涨幅:<select id="zhangfu">
        <option value="全部">全部</option>
        <option value="涨停">涨停</option>
        <option value="非涨停">非涨停</option>
        </select>
    最后封板时间:<select id="ban_time">
                <option value="全部">全部</option>
                <option value="10点前">10点前</option>
                <option value="10点至11点半">10点至11点半</option>
                <option value="下午">下午</option>
                </select>
    第一次封板金额:<select id="first_ban_money">
                    <option value="全部">全部</option>
                    <option value="小于300万">小于300万</option>
                    <option value="300-600">300-600</option>
                    <option value="600-1000">600-1000</option>
                    <option value="1000-1500">1000-1500</option>
                    <option value="大于1500">大于1500</option>
                    </select>
    最后封板金额:<select id="last_ban_money">
                <option value="全部">全部</option>
                <option value="小于300万">小于300万</option>
                <option value="300-600">300-600</option>
                <option value="600-1000">600-1000</option>
                <option value="1000-1500">1000-1500</option>
                <option value="大于1500">大于1500</option>
                </select>
    最大封板金额:<select id="max_ban_money">
            <option value="全部">全部</option>
            <option value="小于300万">小于300万</option>
            <option value="300-600">300-600</option>
            <option value="600-1000">600-1000</option>
            <option value="1000-1500">1000-1500</option>
            <option value="大于1500">大于1500</option>
            </select>
    板上总成交金额:<select id="total_ban_money">
        <option value="全部">全部</option>
        <option value="小于1000万">小于1000万</option>
        <option value="1000-5000">1000-5000</option>
        <option value="5000-1亿">5000-1亿</option>
        <option value="1亿-2亿">1亿-2亿</option>
        <option value="2亿-3亿">2亿-3亿</option>
        <option value="大于3亿">大于3亿</option>
        </select>
    封单金额:<select id="buy_one_money">
    <option value="全部">全部</option>
    <option value="小于1000万">小于1000万</option>
    <option value="1000-5000">1000-5000</option>
    <option value="5000-1亿">5000-1亿</option>
    <option value="1亿-2亿">1亿-2亿</option>
    <option value="2亿-3亿">2亿-3亿</option>
    <option value="大于3亿">大于3亿</option>
    </select>
    个股当日总成交金额:<select id="total_money">
    <option value="全部">全部</option>
    <option value="小于5000万">小于5000万</option>
    <option value="5000-1亿">5000-1亿</option>
    <option value="1亿-2亿">1亿-2亿</option>
    <option value="2亿-4亿">2亿-4亿</option>
    <option value="4亿-6亿">4亿-6亿</option>
    <option value="6亿-8亿">6亿-8亿</option>
    <option value="大于8亿">大于8亿</option>
    </select>
    流通市值:<select id="float_money">
    <option value="全部">全部</option>
    <option value="小于5亿">小于5亿</option>
    <option value="5亿-10亿">5亿-10亿</option>
    <option value="10亿-15亿">10亿-15亿</option>
    <option value="15亿-20亿">15亿-20亿</option>
    <option value="20亿-50亿">20亿-50亿</option>
    <option value="50亿-100亿">50亿-100亿</option>
    <option value="100亿-150亿">100亿-150亿</option>
    <option value="150亿以上">150亿以上</option>
    </select>
    </div>
    <br/>

    <!--<div align="center">-->
    <!--<button onclick="query()">查询</button>-->
    <!--<button onclick="clearCondition()">清空条件</button>-->
    <!--</div>-->

        <div align="center">
        <div class="btn-group btn-group-lg" role="group" aria-label="...">
        <div class="btn-group" role="group" align="center">
        <button type="button" class="btn btn-primary" onclick="query()">查询</button>
        </div>
        <div class="btn-group" role="group" align="center">
        <button type="button" class="btn btn-primary" onclick="clearCondition()">清空条件</button>
        </div>
        </div>

        <button type="button" class="btn btn-info" onclick="chuBanHistory()">历史记录</button>
        <br/>
        <br/>
        </div>

</div>
<div id="dataTable" class="table table-striped table-bordered" cellspacing="0" width="80%">
</div>
{#<script src="{{url_for('static',filename='js/chuBanHistory.js')}}"></script>#}
<script src="{{url_for('static',filename='js/conditionSelect_9_4.js')}}"></script>
<script type="text/javascript" >
function chuBanHistory(){
    window.open('./chubanMonitor/history');
}
// the data table itself
var dataTable = null;

jQuery(document).ready(function () {

    dataTable = jQuery("#dataTable").raytable({
        datasource: { data: [], keyfield: 'stock_code' },
        columns: [
            { field: "stock_code", title: "股票代码"},
            { field: "stock_name", title: "股票名称"},
            { field: "total_deal_amount", title: "当日成交总量(万元)",sort:true },
            { field: "zhangfu", title: "涨幅", sort: true },
            { field: "buy_one", title: "封单(买一)金额(万元)",sort:true  },
            <!--{ field: "lzt_deal_amount", title: "总拉停金额(万元)",sort:true  },-->
            { field: "first_lzt_deal_amount", title: "第一次封板金额(万元)",sort:true  },
            { field: "new_lzt_deal_amount", title: "最后封板金额(万元)",sort:true  },
            { field: "new_lzt_time", title: "最后封板时间"},
            { field: "max_lzt_deal_amount", title: "最大封板金额(万元)",sort:true  },
            { field: "ban_deal_amount", title: "板上总成交金额(万元)",sort:true},
            { field: "float_money", title: "流通市值(亿)",sort:true},
            { field: "ban_deal_rate", title: "板上成交率(%)",sort:true}

        ],
        pagesize: 100,
        maxPageButtons: 5,
        rowNumbers: true

    });

});

addData();
setInterval(function (){
    addData();
}, 60000);

function addData(){

        $.ajax({
            url: "/chubanStockInfo", async: true, success: function (data) {
                    var obj = JSON.parse(data);

                    var zhangTingStockInfoData=obj.zhangTingStockInfoData;

                    var outputlist=getCondition(zhangTingStockInfoData);
                    doLoad(outputlist);
            }
        });

    }

// load some data
function doLoad(zhangTingStockInfoData) {
    var zhangTingStockInfoDataTemp=zhangTingStockInfoData;
    for(i=0;i<zhangTingStockInfoDataTemp.length;i++){
        //单位 万元 保留三位

        zhangTingStockInfoDataTemp[i]['total_deal_amount']=(zhangTingStockInfoData[i]['total_deal_amount']/10000).toFixed(3);
        zhangTingStockInfoDataTemp[i]['ban_deal_amount']=(zhangTingStockInfoData[i]['ban_deal_amount']/10000).toFixed(3);
        <!--zhangTingStockInfoDataTemp[i]['lzt_deal_amount']=(zhangTingStockInfoData[i]['lzt_deal_amount']/10000).toFixed(3);-->
        zhangTingStockInfoDataTemp[i]['first_lzt_deal_amount']=(zhangTingStockInfoData[i]['first_lzt_deal_amount']/10000).toFixed(3);
        zhangTingStockInfoDataTemp[i]['new_lzt_deal_amount']=(zhangTingStockInfoData[i]['new_lzt_deal_amount']/10000).toFixed(3);
        zhangTingStockInfoDataTemp[i]['max_lzt_deal_amount']=(zhangTingStockInfoData[i]['max_lzt_deal_amount']/10000).toFixed(3);
        zhangTingStockInfoDataTemp[i]['buy_one']=(zhangTingStockInfoData[i]['buy_one']/10000).toFixed(3);
        //亿
        zhangTingStockInfoDataTemp[i]['float_money']=(zhangTingStockInfoData[i]['float_money']/100000000).toFixed(2);
    }
    dataTable.data(zhangTingStockInfoDataTemp,'stock_code');
}

</script>

<style type="text/css">
    #dataTable table tr:hover td { background-color: palegoldenrod; }
</style>
</body>
</html>